package com.liangzhong.modules.club.command
{
	import com.liangzhong.constants.ApplicationConstants;
	import com.liangzhong.proxy.club.ClubProxy;
	import com.liangzhong.proxyconstant.club.ClubProxyConstant;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 *俱乐部 
	 * @author Administrator
	 * 
	 */	
	public class ClubCommand extends SimpleCommand
	{
		public function ClubCommand()
		{
			super();
		}
		override public function execute(notification:INotification):void
		{
			var clubProxy:ClubProxy = facade.retrieveProxy(ClubProxy.PROXYNAME) as ClubProxy;
//			var userId:int = AppData.getInstance().user.uid;  						//登录的uid
//			var userKey:String = AppData.getInstance().user.key;					//验证码
//			var clubId:int = AppData.getInstance().user.userDetailInfo.cid;
			switch(notification.getName())
			{
				case ApplicationConstants.Club_Get_ClubInfo://获取俱乐部信息
					clubProxy.requestClubInfo();
					break;
				case ClubProxyConstant.CLUB_MEDIATOR_NOTIFICATION://mediator处理
					mediatorNotification(notification);
					break;
			}
		}
		/**
		 * clubMediator -->clubCommand 通知
		 * @param notification
		 * 
		 */		
		private function mediatorNotification(notification:INotification):void
		{
			var clubProxy:ClubProxy = facade.retrieveProxy(ClubProxy.PROXYNAME) as ClubProxy;
			switch(notification.getType())
			{
				case ClubProxyConstant.CHANGELOGO://改变队徽
					clubProxy.changeLogo(notification.getBody());
					break;
				case ClubProxyConstant.CHANGESHIRT:
					clubProxy.changeShirt(notification.getBody());
					break;
				case ClubProxyConstant.CHANGENATION:
					clubProxy.changeNation(notification.getBody());
					break;
			}
		}
	}
}